package it.cast.wechat.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;


//新增加一个类用来添加虚拟路径映射
@Configuration
public class MvcConfig implements WebMvcConfigurer {
    @Value("${fileRealPath}")
    private String fileRealPath;

    @Value("${fileSonPath}")
    private String fileSonPath;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/image/**").addResourceLocations("file:///"+fileRealPath+"/"+fileSonPath+"/");
    }
}